﻿using CodeCity.SDK;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Routing;
using Swashbuckle.AspNetCore.Swagger;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CodeCity.UserManagement.Admin.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class CheckController : ControllerBase
    {
        private readonly ISwaggerProvider swaggerProvider;

        public CheckController(ISwaggerProvider swaggerProvider)
        {
            this.swaggerProvider = swaggerProvider;
        }
        [HttpGet]
        public IActionResult InitializeAsync()
        {
            var document = swaggerProvider.GetSwagger("v1");
            var result = new CheckResult()
            {
                Paths = document.Paths.Select(x => x.Key).ToArray()
            };
            return Ok(result);
        }
    }
}
